package com.xzy.fruitmall.controller;

import com.alibaba.fastjson.JSONArray;
import com.xzy.fruitmall.mapper.CustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sgg")
public class CustomerController {
    @Autowired
    private CustomerMapper customerMapper;

    @GetMapping(value = {"/LoginByAccount/{customerAccount}/{customerPass}"})
    public String LoginByAccount(@PathVariable("customerAccount") String customerAccount,
                                @PathVariable("customerPass") String customerPass){
        String str= JSONArray.toJSONString(customerMapper.LoginByAccount(customerAccount,customerPass));
        return str;
    }

    @GetMapping(value = {"/LoginByTel/{customerTel}/{customerPass}"})
    public String LoginByTel(@PathVariable("customerTel") String customerTel,
                                @PathVariable("customerPass") String customerPass){
        String str= JSONArray.toJSONString(customerMapper.LoginByTel(customerTel,customerPass));
        return str;
    }
}
